package mvp.cklm.testtask.model;

import mvp.cklm.testtask.model.enums.PhoneType;

/**
 * Created with IntelliJ IDEA.
 * User: WORKSPOT2
 * Date: 24.02.14
 * Time: 20:36
 * To change this template use File | Settings | File Templates.
 */
public class PhoneNumber {
    private PhoneType type;
    private String phoneNumber;

    public PhoneNumber(PhoneType type, String phoneNumber) {
        this.type = type;
        this.phoneNumber = phoneNumber;
    }

    public PhoneType getType() {
        return type;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof PhoneNumber)) return false;

        PhoneNumber that = (PhoneNumber) o;

        if (!phoneNumber.equals(that.phoneNumber)) return false;
        if (type != that.type) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = type.hashCode();
        result = 31 * result + phoneNumber.hashCode();
        return result;
    }
}
